package gw.com.android.ui.trade;

import gw.com.jni.library.terminal.GTSConst;
import www.com.library.model.DataItemDetail;

/**
 * Created by reeta.zou on 2016/9/7.
 * 下单时范围值对象
 */
public class TradeRangeModel {
    public int mTradeDir; //买卖方向
    public String mSysPrice = ""; //系统价
    public int stepPrice;
    public int mDigit; //小数位

    public double priceToPoint = 0;/** 价格转换成点数时系数 */
    public double pointToPrice = 0;/** 点数转换成价格时系数 */
    public String defalutLossPrice = "";/** 止损默认价格值 */
    public String defalutWinPrice = "";/** 止盈默认价格值 */
    public String defalutLossPoint = "";/** 止损默认价格值 */
    public String defalutWinPoint = "";/** 止盈默认价格值 */
    public String minRangeLoss = "";/**止损左边范围 */
    public String maxRangeLoss = "";/**止损右边范围 */
    public String minRangeWin = ""; /**止盈左边范围  */
    public String maxRangeWin = "";/**止盈右边范围  */
    public String minPips = ""; //止损左边点数范围
    public String maxPips = ""; //止盈右边点数范围
    //挂单
    public String defalutPrice = "";/**挂单价默认价格值 */
    public String minRangePrice = "";/**挂单价左边范围 */
    public String maxRangePrice = "";/**挂单价右边范围 */

    public void setData(DataItemDetail mItem){
        minPips = mItem.getString(GTSConst.JSON_KEY_MINPIP);
        maxPips = mItem.getString(GTSConst.JSON_KEY_MAXPIP);
        mDigit = mItem.getInt(GTSConst.JSON_KEY_DIGITS);
        stepPrice = mItem.getInt(GTSConst.JSON_KEY_PRICESTEP);
        defalutLossPoint = minPips;
        defalutWinPoint = minPips;
        pointToPrice = Math.pow(10, -mItem.getInt(GTSConst.JSON_KEY_PRICESTEP));
        priceToPoint = Math.pow(10, mItem.getInt(GTSConst.JSON_KEY_PRICESTEP));
    }
}
